package com.cdtye.itps.cms.service.dict;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cdtye.common.mybatiscore.base.BaseService;
import com.cdtye.itps.cms.dao.dict.entity.SysDictionary;
import com.cdtye.itps.cms.dao.dict.vo.SysDictionaryVo;
import com.cdtye.itps.cms.mapper.dict.SysDictionaryMapper;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class SysDictionaryService extends BaseService<SysDictionaryMapper, SysDictionary> {

    public List<SysDictionary> dictListByTypeCode(String typeCode){
        QueryWrapper<SysDictionary> wrapper = new QueryWrapper<>();
        wrapper.eq("DT_ID",typeCode);
        //wrapper.eq("DEL_FLAG","N");
        return baseMapper.selectList(wrapper);
    }

    public List<SysDictionary> dictListByTypeCodeNormal(String typeCode){
        QueryWrapper<SysDictionary> wrapper = new QueryWrapper<>();
        wrapper.eq("DT_ID",typeCode);
        wrapper.eq("STATUS","NORMAL");
        return baseMapper.selectList(wrapper);
    }

    public IPage<Map<String, Object>> pageList4Brain(SysDictionaryVo vo) {
        return baseMapper.pageList4Brain(vo.page(), vo);
    }
}
